﻿@model HRWEB.Models.AddThesisModel
@using HRWEB.HtmlHelpers
<script type="text/javascript">
    jQuery(document).ready(function () {
        $('#magazineList').dataTable({
            "bPaginate": true,
            "bFilter": false,
            "bSort": true,
            "bInfo": false,
            "bAutoWidth": false,
            "bStateSave": true,
            "fnDrawCallback": function (oSettings) {
                $(".detail-table-small tr").each(function (i) {
                    $(this).hover(function () {
                        $(this).addClass('color3');
                    }, function () {
                        $(this).removeClass('color3');
                    });
                    if ($(this).hasClass('color1')) {
                        $(this).removeClass('color1');
                    }
                    if ($(this).hasClass('color2')) {
                        $(this).removeClass('color2');
                    }
                    if (i % 2) { $(this).addClass('color1'); }
                    else { $(this).addClass('color2'); }
                });
            }
        });
    });
    function SetSelected(serialNO) {
        $("#SelectedMagaNO").val(serialNO);   
    }
</script>
<div align="left" style="font-size:14px">   
@using (Html.BeginForm())
{
    <table>
    <tr><td>请先选择发表期刊：</td><td>输入名称来进行模糊查询</td><td>@Html.TextBoxFor(p=>p.InputMaga)</td><td style="font-size:10px"><input type="submit" value="查询" /></td></tr>
    </table>
    @Html.Hidden("SelectedMagaNO");
    <table id="magazineList" class="detail-table-small">
    <thead>@Html.GetTableRow(new string[] { "期刊名称", "期刊类别", "CN", "ISSN", "选择"})</thead>
    <tbody>
@foreach (var it in Model.Magazines)
{
<tr><td>@it.Name</td><td>@Html.FormatTDict(it.DictMagazineType)</td><td>@it.CN</td><td>@it.ISSN</td><td style="font-size:9px"><input type="submit" value="选择" style="width:45px" onclick="SetSelected(@it.SerialNO)"/></td></tr>    
}
    </tbody>
    </table>
    
  var sel = Model.Magazines.Where(p => p.SerialNO == Model.SelectedMagaNO);
  string magaName = "";
  if(sel.Any()){
      magaName = sel.Single().Name;
  }
  
<div style="font-weight:bold;font-size:medium">当前选择期刊名称：@(magaName)</div>
<table class="detail-table-edit">
<thead>@Html.GetTableHeadRow(new string[] { "发表时间", "论文题目", "类别", "位次", "收录","增加" })</thead> 
<tbody>
<tr><td>@Html.TextBoxFor(x => x.NewThesis.Date, new { style = "width:100px" ,id="tbDate",@readonly="readonly",onClick = "WdatePicker({startDate:'2011-01-01',minDate:'1970-01-01'})"})</td><td>@Html.TextBoxFor(p => p.NewThesis.Title, new { style = "width:410px" })</td><td>@Html.DropDownListFor(p=>p.NewThesis.ThesisTypeCode,DropDownListHelper.ThesisTypeList())</td><td>@Html.DropDownListFor(p=>p.NewThesis.AuthorOrderCode,DropDownListHelper.ThesisAuthorOrderList())</td><td>@Html.DropDownListFor(p=>p.NewThesis.MagazineIndexCode,DropDownListHelper.TheisMagazineIndexList())</td><td style="font-size:10px"><input type="submit" value="增加" /></td></tr>
</tbody></table>
    }
</div>